package com.xbao.dao;

import com.xbao.model.Notice;
import com.xbao.model.NoticeExample;
import java.util.List;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
@Mapper
public interface NoticeMapper {
    @SelectProvider(type=NoticeSqlProvider.class, method="countByExample")
    int countByExample(NoticeExample example);

    @DeleteProvider(type=NoticeSqlProvider.class, method="deleteByExample")
    int deleteByExample(NoticeExample example);

    @Delete({
        "delete from notice",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into notice (id, accepttype, ",
        "title, contents, ",
        "url, createtime, ",
        "updatetime, sid, cid, ",
        "orgid)",
        "values (#{id,jdbcType=BIGINT}, #{accepttype,jdbcType=INTEGER}, ",
        "#{title,jdbcType=VARCHAR}, #{contents,jdbcType=VARCHAR}, ",
        "#{url,jdbcType=VARCHAR}, #{createtime,jdbcType=BIGINT}, ",
        "#{updatetime,jdbcType=BIGINT}, #{sid,jdbcType=BIGINT}, #{cid,jdbcType=BIGINT}, ",
        "#{orgid,jdbcType=BIGINT})"
    })
    int insert(Notice record);

    @InsertProvider(type=NoticeSqlProvider.class, method="insertSelective")
    int insertSelective(Notice record);

    @SelectProvider(type=NoticeSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="accepttype", property="accepttype", jdbcType=JdbcType.INTEGER),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="contents", property="contents", jdbcType=JdbcType.VARCHAR),
        @Result(column="url", property="url", jdbcType=JdbcType.VARCHAR),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="updatetime", property="updatetime", jdbcType=JdbcType.BIGINT),
        @Result(column="sid", property="sid", jdbcType=JdbcType.BIGINT),
        @Result(column="cid", property="cid", jdbcType=JdbcType.BIGINT),
        @Result(column="orgid", property="orgid", jdbcType=JdbcType.BIGINT)
    })
    List<Notice> selectByExample(NoticeExample example);

    @Select({
        "select",
        "id, accepttype, title, contents, url, createtime, updatetime, sid, cid, orgid",
        "from notice",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="accepttype", property="accepttype", jdbcType=JdbcType.INTEGER),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="contents", property="contents", jdbcType=JdbcType.VARCHAR),
        @Result(column="url", property="url", jdbcType=JdbcType.VARCHAR),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="updatetime", property="updatetime", jdbcType=JdbcType.BIGINT),
        @Result(column="sid", property="sid", jdbcType=JdbcType.BIGINT),
        @Result(column="cid", property="cid", jdbcType=JdbcType.BIGINT),
        @Result(column="orgid", property="orgid", jdbcType=JdbcType.BIGINT)
    })
    Notice selectByPrimaryKey(Long id);

    @UpdateProvider(type=NoticeSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Notice record, @Param("example") NoticeExample example);

    @UpdateProvider(type=NoticeSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Notice record, @Param("example") NoticeExample example);

    @UpdateProvider(type=NoticeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Notice record);

    @Update({
        "update notice",
        "set accepttype = #{accepttype,jdbcType=INTEGER},",
          "title = #{title,jdbcType=VARCHAR},",
          "contents = #{contents,jdbcType=VARCHAR},",
          "url = #{url,jdbcType=VARCHAR},",
          "createtime = #{createtime,jdbcType=BIGINT},",
          "updatetime = #{updatetime,jdbcType=BIGINT},",
          "sid = #{sid,jdbcType=BIGINT},",
          "cid = #{cid,jdbcType=BIGINT},",
          "orgid = #{orgid,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Notice record);
}